Standardize Python packaging and isolate bundled MLIR - #1016
Conversation
94ca0cc to
0acf08e
Compare
|
[P1] The ptoas-vmi sdist is not self-contained. pyproject.toml (line 44) references CMake and packages through ../... Building the sdist produced only pyproject.toml and PKG-INFO; rebuilding a wheel from it failed because the referenced CMake source tree was absent. Any source installation or package-index sdist fallback will fail. The VMI project must stage/include its complete sources and use paths internal to the sdist. |
|
已在
补充验证:两个 workflow YAML 均可解析;相关 Python 文件 |
42e9c8e to
dfad6ce
Compare
Review:缺陷与风险汇总整体方向(收敛到 scikit-build-core、隔离 高(建议合入前处理)
中
低
需作者确认的行为变更
建议优先修 1、2、5(确定性故障)并补 4 的真实冒烟测试,其余可作 follow-up。 |
44ef28c to
59396a9
Compare
|
已按这轮意见在
验证:shell 脚本 |
|
补充:新 head 的 已在 |
二轮 review:以下两个高危项仍未处理感谢修复 Dockerfile wheel 验证、死环境变量清理和低精度类型导出。rebase 后的 delta 我核对过,质量没问题。但一轮 review 中的这两个高危项在最新 head( 1. 所有新测试都 mock 掉了
|
|
这两条我结合当前 head 的 workflow、脚本和实际门禁日志重新核对了,当前都已有覆盖或保护,不需要再改代码。
|
背景
PTOAS 原先通过自定义 PEP 517 backend、
setup.py、wheel bootstrap、运行时路径扫描和多套发布脚本维护 Python 包。这些代码重复承担了标准打包工具已有的 metadata、editable install、console script、wheel 组装和 native dependency repair,也使 CLI、PTODSL、CI、wheel 和 standalone archive 显式依赖源码树、LLVM build tree 或旧 install tree 的内部布局。同时,直接发布顶层
mlir包会与进程中的其他 MLIR Python distribution 冲突。PTOAS 需要拥有一套自洽的 MLIR Python runtime,并让 compiler native module 与 Python bindings 共享同一套 MLIR CAPI。本 PR 将 Python 构建与发布链路收敛到 scikit-build-core、AddMLIRPython 和标准平台 repair 工具,并把 PTOAS 自带的 MLIR runtime 隔离到
ptoas.mlir。修改内容
scikit-build-core作为标准 PEP 517/660 backend:ptoas;packaging/ptoas-vmi发布ptoas-vmi;setup.py和 wheel bootstrap。ptoas.mlir和ptoas.mlir.dialects.pto;MLIR_PYTHON_PACKAGE_PREFIX=ptoas.mlir.和独立 nanobind domain;mlir。PTOASPythonCAPI;-Werror,PTOAS 自有代码继续保持-Werror。ptoas._core:_core,不再扫描 native library 路径。ptoas._cli:main;PTOAS_BIN,否则使用标准PATH;_bootstrap.py、_runtime_entry和跨源码/build/install tree 的路径猜测。ptoas-vmi的 PEP 621 version 是 VMI distribution 的唯一版本源;SKBUILD_PROJECT_VERSION_FULL将版本传给 CMake/CLI;PTOAS_VMI_VERSION扫描、同步脚本和自动 patch bump;auditwheel repair,macOS wheel 使用delocate-wheel;.so/.dylibcommon CAPI。quick_install.sh使用标准 editable install;PTOAS_Python和PTOAS_CompilerArchive两个 CMake component 组装受控 install tree;_core和PTOASPythonCAPI;file(GET_RUNTIME_DEPENDENCIES)收集外部依赖并检查 unresolved/ABI 冲突;$ORIGINRPATH,macOS 使用delocate-path;验证
在重放到最新
main后:ptoas 0.53、ptoas-vmi 0.1.4。LD_LIBRARY_PATH/PYTHONPATH后:ptoas.mlir.ir、PTO dialect 和ptoas._core可导入;ptoas --version输出ptoas vmi 0.1.4。git diff --check通过。同一变更在重放前的 release dry-run 中完成了 Linux 全矩阵验证:
ptoas_vmi-0.1.4wheel;auditwheel repair、隔离安装测试和 artifact 上传;范围说明
ptoas与ptoas-vmi会安装相同的顶层 Python package 和 console script,因此两个 distribution 互斥,不应装入同一环境。.dylibpayload validation,并进入delocaterepair;完整 macOS matrix 由本 PR 的 workflow 继续覆盖。